<template>
	<myWaterFall :dataList='waterFallData'>
		<template v-slot:left="{leftList}">
			<view class="demo-warter" v-for="item in leftList" :key="item.id">
				<icard :icardall="item"></icard>
			</view>
		</template>
		<template v-slot:right="{rightList}">
			<view class="demo-warter" v-for="item in rightList" :key="item.id">
				<icard :icardall="item"></icard>
			</view>
		</template>
	</myWaterFall>
</template>

<script>
	import myWaterFall from '../common/myWaterFall'
	import icard from './icard'
	export default {
		components: {
			myWaterFall,
			icard
		},
		props: {
			dataList: {
				type: Array,
				default: function() {
					/* 参数示例 */
					return [{
						goodsMainImgUrl: "https://img.js.design/assets/img/6251575ceeddd8c6587e10cc.jpg",
						thispresale: true,
						goodsVarieties: "苹果",
						goodsProductionArea: "贵州省黔南州长顺县",
						goodsPrice: "19",
						goodsId: "12312312",
					}]
				}
			}
		},
		data() {
			return {
				list: []
			}
		},
		computed: {
			waterFallData() {
				const list = []
				for (let item of this.dataList) {
					list.push({
						goodsName: item['productName'] || null,
						goodsId: item["id"] || null,
						goodsMainImgUrl: item["productCover"] || null,
						thispresale: item["thispresale"] ? item["thispresale"] : false,
						goodsSpecies: item["productSpecies"] || null,
						goodsVarieties: item["productVariety"] || null,
						goodsProductionArea: item["productProductionArea"] || null,
						goodsPrice: item["productPrice"] || 0,
						goodsType: item["type"] || 0
					})
				}
				return list
			}
		}
	}
</script>

<style>
	.demo-warter {
		border-radius: 8px;
		margin-bottom: 20rpx;
	}
</style>
